Small Website to play Web-based games.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

17 line
480 B

  1. // Next.js API route support: https://nextjs.org/docs/api-routes/introduction
  2. import type { NextApiRequest, NextApiResponse } from 'next'
  3. import {Game, getAvailableGames} from '../../../utils/games';
  4. export default async function handler(
  5. req: NextApiRequest,
  6. res: NextApiResponse<Game>
  7. ) {
  8. const gameManifests = await getAvailableGames();
  9. const game = gameManifests.find((g) => g.id === req.query.id);
  10. if (game) {
  11. res.json(game)
  12. return
  13. }
  14. res.status(404)
  15. }